package com.webcamtracker.video;

import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;

public class VideoSuscriptionSupport {
    private List<VideoSuscriptor> videoSuscriptor = new ArrayList<VideoSuscriptor>();

    public List<VideoSuscriptor> getVideoSuscriptor() {
        return videoSuscriptor;
    }

    public void removeVideoSuscriptor(VideoSuscriptor videoSuscriptor) {
        this.videoSuscriptor.remove(videoSuscriptor);
    }

    public void addVideoSuscriptor(VideoSuscriptor videoSuscriptor) {
        this.videoSuscriptor.add(videoSuscriptor);
    }

    public void deliveryFrame(BufferedImage bufferedImage) {
        if(bufferedImage != null){
            List<VideoSuscriptor> videoSuscriptors = getVideoSuscriptor();
            for (VideoSuscriptor suscriptor : videoSuscriptors) {
                suscriptor.arrivedFrame(bufferedImage);
            }

        }
    }
}
